UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YTM0l0sxsFrAjofy9FnFhw0d/vI2N5q8eYpSvU8GCcY=' 
WHERE 
  key_id = '4de1499058d5dfb5c501702b7ecafa9209222cc8bd03075d0d07d07712761566' 
  AND (
    token = 'YTM0l0sxsFrAjofy9FnFhw0d/vI2N5q8eYpSvU8GCcY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031