UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NHITOFR4YL5iQyYlxwslArT8cqO41U2smBYsgAKh7YA=' 
WHERE 
  key_id = '7a64d19929fd17db22d1c3d8803074361ef792390400f137d3ccd643dab4b0cf' 
  AND (
    token = 'NHITOFR4YL5iQyYlxwslArT8cqO41U2smBYsgAKh7YA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031