UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j6NYUiyh27HN81H8j9OckzHb8FM5E6jKxw6GapZnVoc=' 
WHERE 
  key_id = 'a08988b754452f079eb2851cdce8d4ba86544486d7eaca197168bbc9005c816a' 
  AND (
    token = 'j6NYUiyh27HN81H8j9OckzHb8FM5E6jKxw6GapZnVoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023