UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QyllU9onlzwk8nd+zHApGUu7rJ4FdkMIMNRlsWD2LBM=' 
WHERE 
  key_id = '1b414f7458e33095a5f876d4f6ccb42029808c9371d84385d06edf83b0902800' 
  AND (
    token = 'QyllU9onlzwk8nd+zHApGUu7rJ4FdkMIMNRlsWD2LBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044