UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vBu9VIiD2I/339fsu07L6/MXirP7GC85tgWl2+mUHpo=' 
WHERE 
  key_id = '7b8cd1834b55a80bd9b69f692f7d0fa9b60979ea976bff21f678617be051ccda' 
  AND (
    token = 'vBu9VIiD2I/339fsu07L6/MXirP7GC85tgWl2+mUHpo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032