UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+0S/ehVvdGYvr4agKFgBInq7Iux8ued4aRaA12vh8o=' 
WHERE 
  key_id = 'abbf9d8069ba2b538d1c8c18a9b629fca7e900faf311822914da4916722fb4ec' 
  AND (
    token = 'L+0S/ehVvdGYvr4agKFgBInq7Iux8ued4aRaA12vh8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00098