UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y59ENSuy2fVMpyeDukUzmBPlVESaFs7iMYh5xoIQ+8s=' 
WHERE 
  key_id = '42156c5fe3ebebffffa720e3967cb784a795df1705a5eebd2af37c68089833ec' 
  AND (
    token = 'y59ENSuy2fVMpyeDukUzmBPlVESaFs7iMYh5xoIQ+8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035