UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yN1gVVNU2aqyOnYUfciIpJxOaeCr4uUGVbCdTVrmqZE=' 
WHERE 
  key_id = 'bb456c22546d5a260d8dd17394d63859e2b9c19258f3f92f0b1e95013c75b3c3' 
  AND (
    token = 'yN1gVVNU2aqyOnYUfciIpJxOaeCr4uUGVbCdTVrmqZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029