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

Query time 0.00038