UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wjUQkwjtjrVECKT0PMlBmxwr6bPRFCjPGbqbV0tNqw0=' 
WHERE 
  key_id = '811ee87cef50004e46050b1b902bf21eaae457067a14b4afa918187c51c0d2f5' 
  AND (
    token = 'wjUQkwjtjrVECKT0PMlBmxwr6bPRFCjPGbqbV0tNqw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023