UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZOgyWYT9vCG/ZxwyC6+UWr5v31qxq6poJrOiDgYPo2w=' 
WHERE 
  key_id = '7fcb340a40747c7a89dcdee99164bd6469d793191ac27e2d8a77c04f8c502321' 
  AND (
    token = 'ZOgyWYT9vCG/ZxwyC6+UWr5v31qxq6poJrOiDgYPo2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044