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

Query time 0.00026