UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xjiKPKPVyP0uEita5w/gR3+TNHTjuQbIGwhfkxuXc4Q=' 
WHERE 
  key_id = 'b476ca78d2d2f86fde5c9412d7b651861ae0cde2369c540d8098d26f3f8e44c3' 
  AND (
    token = 'xjiKPKPVyP0uEita5w/gR3+TNHTjuQbIGwhfkxuXc4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054