UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dhX7z1ZR/dxVvEFsIqlmOotFPn7oGSIcdon/ZpJ0wiw=' 
WHERE 
  key_id = 'b9d4b6da6feb5d4ff93af8826ea0d6adfab216afca6a9739f0c14ee15355ca71' 
  AND (
    token = 'dhX7z1ZR/dxVvEFsIqlmOotFPn7oGSIcdon/ZpJ0wiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034