UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h0fxjUFP1x0AKnFTQGgsWMkYlXCo4eLt9tnav7lD3FY=' 
WHERE 
  key_id = '0ccdb19d2351b89dcb6b01f08a9c13926534173c79f58778fdcad2decb33fce0' 
  AND (
    token = 'h0fxjUFP1x0AKnFTQGgsWMkYlXCo4eLt9tnav7lD3FY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017