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

Query time 0.00029