UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4f6bFrm8gGvGFT05NoJP8TdfzpsmRKpUiu+WWOWor+A=' 
WHERE 
  key_id = '323f8a8bb634b43f7a279e2fba2e101a7494642130c96d9f477f068ba340734c' 
  AND (
    token = '4f6bFrm8gGvGFT05NoJP8TdfzpsmRKpUiu+WWOWor+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037