UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V0UY8BbCH0NvNto0XoZbfQF1hCbykLbxFoIjnbrHN8Y=' 
WHERE 
  key_id = '7ccde284aa82bb2a1c04db6904dba214e7c9f20182a1527ea0736b944f23961e' 
  AND (
    token = 'V0UY8BbCH0NvNto0XoZbfQF1hCbykLbxFoIjnbrHN8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034