UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aYkmQnqnnBWJwYvuZ5q42zOwRp8J1sfkhyb6N1iNnYk=' 
WHERE 
  key_id = '744d634edb2cf1f71f8e05e254fdf28837b358d5c60db54089f7b8cc3b391624' 
  AND (
    token = 'aYkmQnqnnBWJwYvuZ5q42zOwRp8J1sfkhyb6N1iNnYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031