UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p0PgZFegwHbV+ZArUTEqZwTxZygAToxluf6uYteKKTk=' 
WHERE 
  key_id = '26d7db070a709d9ea7c47eea19ece0b0f8484dba47d46834c93bccd950840199' 
  AND (
    token = 'p0PgZFegwHbV+ZArUTEqZwTxZygAToxluf6uYteKKTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029