UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NLfucb653NyXADKnVPkt4aWQxdBjkWKo94703kIKpF4=' 
WHERE 
  key_id = '08a61cd31177ac5402c55b67f6f944a1198ad891dbac54489ec2b15b47776417' 
  AND (
    token = 'NLfucb653NyXADKnVPkt4aWQxdBjkWKo94703kIKpF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032