UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TNjPIpOC4mbJ5HqHfOQFB9QvxC2uAIA0PI5YcrvE+Y0=' 
WHERE 
  key_id = 'ab78c515e1d0194308a920419a6be23eac3638201140f103f06dfe4f7f826caa' 
  AND (
    token = 'TNjPIpOC4mbJ5HqHfOQFB9QvxC2uAIA0PI5YcrvE+Y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025