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

Query time 0.00036